{include file="header.html"}
<script type="text/javascript">
$(function(){

	$('#change_time_from').datepicker({dateFormat: 'yy-mm-dd'});
    $('#change_time_to').datepicker({dateFormat: 'yy-mm-dd'});
    $('#output_btn').bind('click',function(){
        var $hidden_input=$('<input type="hidden" id="out_hid_input" name="isexport" value="1" />');
		$("input[name='act']").val("export");
        $('#output_form').prepend($hidden_input).submit();
		$("input[name='act']").val("index");
        $('#out_hid_input').remove();
    });
});
function checkForm()
{
    var change_time_from = $('#change_time_from').val();
    var change_time_to = $('#change_time_to').val();
    var Days = false;
    if(change_time_from == '' || change_time_to == '')
    {
        alert("请选择激活时间");
        return false;
    }
    if(change_time_from > change_time_to)
    {
        alert("开始时间不能大于结束时间");
        return false;
    }
    Days = getDays(change_time_from,change_time_to);
    if(!Days)
    {
        alert("查询的激活时间区间不能大于2个月");
        return false;
    }
   return true;
}
function getDays(strDateStart,strDateEnd){
    var strSeparator = "-"; //日期分隔符
    var oDate1;
    var oDate2;
    var iDays;
    oDate1= strDateStart.split(strSeparator);
    oDate2= strDateEnd.split(strSeparator);
    if(oDate2[0]-oDate1[0]>1)
    {
        return false;
    }
    if(oDate2[0]-oDate1[0]==1)
    {
        oDate2[1] = parseInt(oDate2[1])+12;
    }
    if(oDate2[1]-oDate1[1]>2)
    {
        return false;
    }
    return true;
}
</script>
<div id="rightTop">
  <p>激活的礼品卡</p>
  <ul class="subnav">
    <li><span>{$lang.manage}</span></li>
  </ul>
</div>
<div class="mrightTop">
  <div class="fontl">
    <form method="get" id="output_form" onsubmit="return checkForm();">
      <div class="left">
        <input type="hidden" name="app" value="pointcard" />
        <input type="hidden" name="act" value="activate" />
        激活时间从:<input class="queryInput pick_date" type="text" value="{$change_time_from|date}" id="change_time_from" name="change_time_from"  />
        至:<input class="queryInput pick_date" type="text" value="{$change_time_to|date}" id="change_time_to" name="change_time_to" />
        <input type="submit" class="formbtn" value="{$lang.query}" />
      </div>
      <!--{if $filtered}-->
      <a class="left formbtn1" href="index.php?app=pointcard&act=activate">{$lang.cancel_query}</a>
      <!--{/if}-->
    </form>
  </div>
</div>
<div class="tdare">
  <table width="100%" cellspacing="0" class="dataTable">
    <!--{if $pointcards}-->
    <tr class="tatr1">
      <td class="firstCell" width="20%">激活日期</td>
      <td>激活卡数量</td>
      <td>操作</td>
    </tr>
    <!--{/if}-->
    <!--{foreach from=$pointcards item=card}-->
    <tr class="tatr2">
      <td class="firstCell">{$card.day}</td>
      <td>{$card.num}</td>
      <td><a href="{url app=pointcard&act=view&date=$card.day}" >查看详情</a></td>
    </tr>
    <!--{foreachelse}-->
    <tr class="no_data">
      <td colspan="10">{$lang.no_data}</td>
    </tr>
    <!--{/foreach}-->
  </table>

  <div id="dataFuncs">
  </div>

</div>
{include file="footer.html"} 